274 PART 5 Looking for Relationships with Correlation and Regression
3.
Tell the software what kind of regression you want it to carry out by
specifying the family of the dependent variable’s distribution and the link
function.
Step 3 is not obvious, and you may have to consult your software’s help file. In
the R program, as an example, you have to specify both family and link in a
single construction, which looks like this:
glm formula
Accidents
Year, family poisson link
“identity”
This code tells R that the outcome is the variable Accidents, the predictor is the
variable Year, and the outcome variable follows the Poisson family of distribu-
tions. The code link
“identity” tells R that you want to fit a model in which
the true event rate rises in a linear fashion, meaning that it increases by a
constant amount each year.
4.
Execute the regression and obtain the output.
The next step is to interpret the output.
TABLE 19-1
Yearly Data on Fatal Highway Accidents in One City
Calendar Year
Fatal Accidents
2010
10
2011
12
2012
15
2013
8
2014
8
2015
15
2016
4
2017
20
2018
20
2019
17
2020
29
2021
28